home *** CD-ROM | disk | FTP | other *** search
- #!/usr/bin/perl
-
- use English;
-
- sub backup_and_install_properties
- {
- my $basepath = shift;
-
- # Does a properties file already exist?
- if (-e $basepath)
- {
- # Back up the user's properties file
- my $count = 1;
- while (-e "${basepath}.bu${count}")
- {
- $count++;
- }
- system("mv ${basepath} ${basepath}.bu${count}");
- }
-
- # Copy the new local.properties file into place (make it 'live')
- system("cp ${basepath}.orig ${basepath}");
- system("chmod g+rw ${basepath}");
- }
-
- sub logit
- {
- open F, ">>/tmp/postinstall.log";
- print F $_[0] . "\n";
- close F;
- }
-
- my $isUpgrade = ($ARGV[4] eq "postupgrade");
-
- # Define the stuff we need to set permissions on
- my @roots = (
- "/Library/DeBabelizerServer/Shared",
- );
- my @ourdirs = (
- "/Library/DeBabelizerServer",
- );
- my @sysdirs = (
- "/",
- "/Library",
- );
-
- # Set the mod flags on all our files
- foreach $r (@roots)
- {
- system("chown -R $ENV{USER} \"$r\"");
- system("chgrp -R mediarich \"$r\"");
- system("chmod -R ug+w,o-w \"$r\"");
- system("chmod -R a+rX \"$r\"");
- }
-
- # Restore the permissions on the stuff the installer screwed up (Apple bug!!!)
- foreach $d (@ourdirs)
- {
- system("chown $ENV{USER} \"$d\"");
- system("chgrp mediarich \"$d\"");
- system("chmod 775 \"$d\"");
- }
-
- open F, "</tmp/.__MR_PERMS__";
- my $line = readline F;
- my %perms = split(/,/, $line);
- close F;
- system("echo -n > /tmp/postinstall.out");
- foreach $d (@sysdirs)
- {
- my @stats = split(/:/, $perms{$d});
- system("chmod $stats[0] \"$d\"");
- system("chown $stats[1] \"$d\"");
- system("chgrp $stats[2] \"$d\"");
- }
-
- backup_and_install_properties("/Library/DeBabelizerServer/Shared/Properties/global.properties");
- backup_and_install_properties("/Library/DeBabelizerServer/Shared/Properties/mime.properties");
-